# StatusEffect.gd（类脚本）
class_name StatusEffect

var effect_type: String
var duration: float
var stack_count: int = 1
var modifier_func: Callable

func _init(type: String, base_duration: float, modifier: Callable):
	effect_type = type
	duration = base_duration
	modifier_func = modifier

func apply(target: Node) -> void:
	modifier_func.call(target, stack_count)

func refresh(new_duration: float) -> void:
	duration = max(duration, new_duration)
	stack_count = min(stack_count + 1, 3)

# 示例状态工厂方法
static func create_hypoxia() -> StatusEffect:
	return StatusEffect.new(
		"hypoxia",
		60.0,
		func(t, s): 
			t.stamina_recovery *= 1.0 - 0.15 * s
			t.max_stamina *= 1.0 - 0.1 * s
	)
